function Can_Player()
{
	Can_Array.apply(this, [ "Player_Can" ]);
}
extend_usemid(Can_Player, Can_Array);

/**
 * 找出对象
 */
Can_Player.prototype.findByUserAttr = function(aAttr, aValue)
{
	var _result = null;
	for ( var i = 0; i < this.datas.length; i++)
	{
		if(this.datas[i]["user"][aAttr] == aValue)
		{
			_result = this.datas[i];
		}
	}
	return _result;
}

Can_Player.prototype.locate_Player = function()
{
}



function Player_Info(owner)
{
	// 都继承fact_game对象
	Fact_Info.apply(this, arguments);
	// 角色 主公 反贼等
	this.role = null;
	// 当前血量
	this.hp_current = 0;
	// 最大血量
	this.hp_maximum = 0;
	// 玩家图片宽高
	this.self_w = 125;
	this.self_h = 181;
	// 所有者
	this.owner = owner;
	// 界面
	this.ui = new Array();
	// 准备图标
	this.ui_state = new Array();
}
extend_usemid(Player_Info, Fact_Info);

/**
 * 初始化一切绘图需要的信息
 */
Player_Info.prototype.init = function()
{
	this.ui["background"] = new UI_Normal(1, "ui_background",
			"media/images/ui/player/player_bg.png", this.owner.position);
	this.ui_state["unready"] = new UI_Normal(1, "unready",
			"media/images/ui/player/unready_logo.png", this.owner.position.offsetPosition(6, 124, 44, 53));
	
	this.ui_state["ready"] = new UI_Normal(1, "ready",
			"media/images/ui/player/ready_logo.png", this.owner.position.offsetPosition(6, 124, 44, 53));

	// 放进碰撞检测列表
	this.owner.updateViewResource(this.ui, 0);
}

// ///////////////////////////
// ///////////////////////////
// ///////////////////////////
// ///////////////////////////
// ///////////////////////////

function Player_Base(a_id, a_factid, a_number)
{
	// 都继承fact_game对象
	Fact_Game.apply(this, arguments);
	// 用户,放着用户信息
	this.user = new User_Normal();
	// 手牌
	this.card_hand = new Can_Card();
	// 已装备的牌
	this.card_equip = new Can_Card();
	// 身份
	this.role = null;
	// 可选武将数量
	this.hero_amount = null;
	// 给你选择的武将
	this.heros = new Can_Hero();
	// 武将
	this.hero = new Hero_Normal();
	// 当前游戏信息,状态,比如血量
	this.fact_info = new Player_Info(this);
	// 玩家位置顺序
	this.number = a_number;
}
extend_usemid(Player_Base, Fact_Game);

Player_Base.prototype.init = function()
{
	Fact_Game.prototype.init.apply(this, arguments);
	this.user.position = this.position.offsetPosition(8, 12, 100, 41);
	this.hero.position = this.position.offsetPosition(8, 12, 100, 41);
	
	this.views.add(this.fact_info.ui);
	this.views.add(this.user);
}


// /////////////////////////////////////////////////
// /////////////////////////////////////////////////
// /////////////////////////////////////////////////
// //////////////////////////////////////////////
// ////////////////////////////////////////////////////
// /////////////////////////////////////////////////

function Player_Normal(a_id, a_factid, a_number)
{
	Player_Base.apply(this, [ a_id, a_factid ]);
	this.view_priority = 5;
}
extend_usemid(Player_Normal, Player_Base);
